home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / version.el.z / version.el
Encoding:
Text File  |  1998-05-21  |  5.0 KB  |  141 lines

  1. ;; Record version number of Emacs.
  2. ;; Copyright (C) 1985, 1991-1994 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of XEmacs.
  5.  
  6. ;; XEmacs is free software; you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; XEmacs is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;; GNU General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU Emacs; see the file COPYING.  If not, write to the
  18. ;; Free Software Foundation Inc., 59 Temple Place - Suite 330,
  19. ;; Boston, MA 02111-1307, USA.
  20.  
  21. ;;; Synched up with: FSF 19.34.
  22.  
  23. ;;; Code:
  24.  
  25. ;;(defconst emacs-version "20.3"
  26. ;;  "Version numbers of this version of XEmacs.")
  27.  
  28. ;;(defconst xemacs-codename "Copenhagen"
  29. ;;  "Release nickname, primarily useful for trial prereleases.
  30. ;;Warning, this variable did not exist in XEmacs versions prior to 20.3")
  31.  
  32. ;;(defconst xemacs-betaname "(beta8)"
  33. ;;  "Non-nil when this is a test (beta) version of XEmacs.
  34. ;;Warning, this variable did not exist in XEmacs versions prior to 20.3")
  35.  
  36. (defconst xemacs-betaname
  37.   (and emacs-beta-version (format "(beta%d)" emacs-beta-version))
  38.   "Non-nil when this is a test (beta) version of XEmacs.
  39. Warning, this variable did not exist in XEmacs versions prior to 20.3")
  40.  
  41. (defconst emacs-version
  42.   (purecopy
  43.    (format "%d.%d %s%s%s"
  44.        emacs-major-version
  45.        emacs-minor-version
  46.        (if xemacs-codename
  47.            (concat "\"" xemacs-codename "\"")
  48.          "")
  49.        (concat " XEmacs "
  50.            (if (not (featurep 'infodock))
  51.                " Lucid"
  52.              ""))
  53.        (if xemacs-betaname
  54.            (concat " " xemacs-betaname)
  55.          "")))
  56.   "Version numbers of this version of XEmacs.")
  57.  
  58. ;; Moved to C code as of XEmacs 20.3
  59. ;(defconst emacs-major-version
  60. ;  (progn (or (string-match "^[0-9]+" emacs-version)
  61. ;         (error "emacs-version unparsable"))
  62. ;         (string-to-int (match-string 0 emacs-version)))
  63. ;  "Major version number of this version of Emacs, as an integer.
  64. ;Warning, this variable did not exist in Emacs versions earlier than:
  65. ;  FSF Emacs:   19.23
  66. ;  XEmacs:      19.10")
  67.  
  68. ;; Moved to C code as of XEmacs 20.3
  69. ;(defconst emacs-minor-version
  70. ;  (progn (or (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
  71. ;         (error "emacs-version unparsable"))
  72. ;         (string-to-int (match-string 1 emacs-version)))
  73. ;  "Minor version number of this version of Emacs, as an integer.
  74. ;Warning, this variable did not exist in Emacs versions earlier than:
  75. ;  FSF Emacs:   19.23
  76. ;  XEmacs:      19.10")
  77.  
  78. (defconst emacs-build-time (current-time-string)
  79.   "Time at which Emacs was dumped out.")
  80.  
  81. (defconst emacs-build-system (system-name))
  82.  
  83. (defun emacs-version  (&optional arg)
  84.   "Return string describing the version of Emacs that is running.
  85. When called interactively with a prefix argument, insert string at point.
  86. Don't use this function in programs to choose actions according
  87. to the system configuration; look at `system-configuration' instead."
  88.   (interactive "p")
  89.   (save-match-data
  90.     (let ((version-string
  91.        (format
  92.         "XEmacs %s %s(%s%s) of %s %s on %s"
  93.         (substring emacs-version 0 (string-match " XEmacs" emacs-version))
  94.         (if (not (featurep 'infodock))
  95.         "[Lucid] "
  96.           "")
  97.         system-configuration
  98.         (cond ((or (and (fboundp 'featurep)
  99.                 (featurep 'mule))
  100.                (memq 'mule features)) ", Mule")
  101.           (t ""))
  102.         (substring emacs-build-time 0
  103.                (string-match " *[0-9]*:" emacs-build-time))
  104.         (substring emacs-build-time
  105.                (string-match "[0-9]*$" emacs-build-time))
  106.         emacs-build-system)))
  107.       (cond
  108.        ((null arg) version-string)
  109.        ((eq arg 1) (message "%s" version-string))
  110.        (t          (insert version-string))))))
  111.  
  112. ;; from emacs-vers.el
  113. (defun emacs-version>= (major &optional minor)
  114.   "Return true if the Emacs version is >= to the given MAJOR and MINOR numbers.
  115. The MAJOR version number argument is required, but the MINOR version number
  116. argument is optional.  If the minor version number is not specified (or is the
  117. symbol `nil') then only the major version numbers are considered in the test."
  118.   (if (null minor)
  119.       (>= emacs-major-version major)
  120.     (or (> emacs-major-version major)
  121.     (and (=  emacs-major-version major)
  122.          (>= emacs-minor-version minor)))))
  123.  
  124. ;;; We hope that this alias is easier for people to find.
  125. (define-function 'version 'emacs-version)
  126.  
  127. ;; Put the emacs version number into the `pure[]' array in a form that
  128. ;; `what(1)' can extract from the executable or a core file.  We don't
  129. ;; actually need this to be pointed to from lisp; pure objects can't
  130. ;; be GCed.
  131. (or (memq system-type '(vax-vms windows-nt ms-dos))
  132.     (purecopy (concat "\n@" "(#)" (emacs-version)
  133.               "\n@" "(#)" "Configuration: "
  134.               system-configuration "\n")))
  135.  
  136. ;;Local variables:
  137. ;;version-control: never
  138. ;;End:
  139.  
  140. ;;; version.el ends here
  141.